﻿using System.Linq;
using System.Windows.Forms;

namespace KTDSMS
{
    public class Unity
    {

        public static void Message(string mess)
        {
            MessageBox.Show(mess, "System Report", MessageBoxButtons.OK);
        }

       
        public static string Incontent(string input)
        {
            string[] Mobifone3 = {"090", "093" };
            string[] Mobifone4 = { "0120", "0121", "0122", "0126", "0128" };

            string[] Viettel3 = { "096", "097", "098" };
            string[] Viettel4 = { "0163", "0164", "0165", "0166", "0167", "0168", "0169" };

            string[] Vinaphone3 = {"091","094"};
            string[] Vinaphone4 = { "0123", "0124", "0125", "0127", "0129"};

            string[] Vietnammobile3 = {"092"};
            string[] Vietnammobile4 = { "0188" };

            string[] Sfone3 = { "095" };

            string[] Gmobile4 = {"0993","0994","0995","0996","0199"};

            char[] num = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

            string s = null;

            int leng = input.Length;

            if (leng < 10 || leng > 11)
            {
                return string.Empty;
            }
            if (input.Any(c => !char.IsDigit(c)))
            {
                return string.Empty;
            }

         
                
            if (leng == 10)
            {
                input = input.Remove(3, 7);
                if (Mobifone3.Any(s1 => input == s1))
                {
                    return "Mobifone";
                }
                if (Viettel3.Any(s1 => input == s1))
                {
                    return "Viettel";
                }
                if (Vinaphone3.Any(s1 => input == s1))
                {
                    return "Vinaphone";
                }

                if (Vietnammobile3.Any(s1 => input == s1))
                {
                    return "Vietnammobile";
                }

                if (Sfone3.Any(s1 => input == s1))
                {
                    return "Sfone";
                }


            }
            else
            {
                input = input.Remove(4, 7);
                if (Mobifone4.Any(s1 => input == s1))
                {
                    return "Mobifone";
                }
                if (Viettel4.Any(s1 => input == s1))
                {
                    return "Viettel";
                }
                if (Vinaphone4.Any(s1 => input == s1))
                {
                    return "Mobifone";
                }
                if (Vietnammobile4.Any(s1 => input == s1))
                {
                    return "Vietnammobile";
                }
                if (Gmobile4.Any(s1 => input == s1))
                {
                    return "Gmobile";
                }
            }
            return string.Empty;
        }
    }
}
